﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace DataModels.Controls
{
    class InputProcesser
    {
    
        //private ComputerInput computerInput;
        private Collection<Command> inputToActionMap;
        //private int sizeOfInputToactionMap;
        //Collection<Command> inputCommands;
        private MouseInput mouseInput;

        public InputProcesser()
        {
            inputToActionMap = new Collection<Command>();
            mouseInput = new MouseInput();
            inputToActionMap.addFirst(new Command("LClick", "Select"));
            inputToActionMap.addFirst(new Command("RClick", "Unselect"));

        }

        public void inputHelper(GameTime gameTime)
        {
            //timerHelper(gameTime);
            //keyboardInput(gameTime);
            //mouseInput(gameTime);
            ComputerInput computerInput = ComputerInput.getComputerInput();
            computerInput.updateTime(gameTime);
            mouseInput.processMouseInput(computerInput,gameTime);
        }

        //private void mouseInput(GameTime gameTime)
        //{
        //    ComputerInput computerInput = ComputerInput.getComputerInput();

        //    solActionToGUI.setHover(computerInput.getMouseLocation());

        //    String message = null;

        //    if (computerInput.isMouseLeftButtonUpClick())
        //    {
        //        message = solActionToGUI.mouseClick(computerInput.getMouseLocation());
        //    }

        //    if (computerInput.isMouseRightButtonUpClick())
        //    {
        //        try
        //        {
        //            solAction.back();
        //        }
        //        catch (Exception e)
        //        {
        //        }
        //    }

        //    if (computerInput.isMouseLeftButtonDown())
        //    {
        //        solActionToGUI.mouseDown(computerInput.getMouseLocation());
        //    }

        //    if (computerInput.getIsMouseMovedAndReset())
        //    {
        //        if (solActionToField != null)
        //            solActionToField.clickMapAT(computerInput.getMouseLocation());
        //    }

        //    if (message != null)
        //    {
        //        if (message.Equals("NoGUI"))
        //        {
        //            try
        //            {

        //                if (solMicroGameStateManager.isStateEqualTo(microGameState.AIM)
        //                    || solMicroGameStateManager.isStateEqualTo(microGameState.MOVING_UNIT))
        //                {
        //                    solAction.command();
        //                }
        //                else
        //                {
        //                    solAction.unselectUnit();
        //                    solActionToField.clickMapAT(computerInput.getMouseLocation());
        //                    //s/olAction.selectUnitAtCurser();
        //                    solAction.command();
        //                    //solAction.command();
        //                    //solAction.command();
        //                    solActionToGUI.showUnitFacePanelAtCurser(solActionToField.getSelectedUnit());
        //                }
        //            }
        //            catch (Exception e)
        //            {

        //            }
        //        }
        //        messageHandler(message);
        //    }
        //}


    }
}
